package sites.manager.common.config;

import com.jfinal.config.Routes;
import sites.manager.admin.account.AccountController;
import sites.manager.admin.index.IndexController;
import sites.manager.admin.login.LoginController;
import sites.manager.admin.role.RoleController;
import sites.manager.admin.site.SiteController;
import sites.manager.common.interceptor.ExceptionInterceptor;
import sites.manager.common.interceptor.LoggedInterceptor;
import sites.manager.common.interceptor.SessionInterceptor;

public class AdminRoutesConfig extends Routes {

    @Override
    public void config() {
        setBaseViewPath("/view");

        addInterceptor(new LoggedInterceptor());
        addInterceptor(new SessionInterceptor());
        addInterceptor(new ExceptionInterceptor());

        add("/login", LoginController.class, "");
        add("/", IndexController.class, "");
        add("/site", SiteController.class, "site");
        add("/account", AccountController.class, "account");
        add("/role", RoleController.class, "role");
    }
}
